package com.tucc.hello.leetcode.no401_800.no461;

/**
 * @author tucc
 * @description todo
 * @package com.tucc.hello.leetcode
 * @date 2021/5/20
 **/
public class Solution {

    public static void main(String[] args) {
        Solution solution = new Solution();
        System.out.println(solution.hammingDistance(1 ,4));
    }

    public int hammingDistance(int x, int y) {
        int z = x ^ y;
        int c = 0;
        while(z > 0){
            if(z % 2 == 1){
                c ++;
            }
            z = z >> 1;
        }
        return c;
    }
}
